package controy

import (
	//	"encoding/json"
	"fmt"
	"io/ioutil"
	//	"log"
	"net/http"
	//	"net/url"
)

func Testparant(w http.ResponseWriter, r *http.Request) {
	r.ParseForm() //解析参数，默认是不会解析的
	if r.Method == "GET" {
		fmt.Println("method:", r.Method) //获取请求的方法

		fmt.Println("username", r.Form["name"])
		fmt.Println("password", r.Form["passd"])

		for k, _ := range r.Form {
			fmt.Print("key:", k, "; ")
			//			fmt.Println("val:", strings.Join(v, ""))
		}
	} else if r.Method == "POST" {
		result, _ := ioutil.ReadAll(r.Body)
		fmt.Println("method:", r.Method) //获取请求的方法
		r.Body.Close()
		fmt.Printf("%s\n", result)
	}
}
